<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active{
      color: red;
    }
  </style>
</head>
<body>
  <div id = "app">
    <a :href="aHref">点击康康</a>
    <h2 class='active'>{{message}}</h2>
    <h2 :class='active'>{{message}}</h2>
    <h2 :class="{active:isActive,line:false}">{{message}}</h2>
    <h2 :class="getClasses()">{{message}}</h2>
    <button @click='changeColor'>点击是否加上类</button>
  </div>
  <script src="../js/vue.js"></script>
  <script>
    const app = new Vue({
      el:'#app',
      data:{
        message:'你好',
        aHref:'http://www.baidu.com',
        active:'active',
        isActive:true
      },
      methods:{
        changeColor(){
          this.isActive = !this.isActive
        },
        getClasses(){
          return {active:this.isActive,line:false}
        }
      }
    })
  </script>
</body>
</html>